package org.jash.mvp2206;

import android.os.Bundle;
import android.widget.RadioGroup;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import org.jash.mvp2206.news.NewsCategoryFragment;
import org.jash.mvp2206.video.VideoFragment;

public class MainActivity2 extends AppCompatActivity {
    private RadioGroup nav;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        nav = findViewById(R.id.nav);
        nav.setOnCheckedChangeListener((group, checkedId) -> {
            if (checkedId == R.id.news) {
                getSupportFragmentManager().beginTransaction().replace(R.id.container, new NewsCategoryFragment()).commit();
            } else if (checkedId == R.id.video) {
                getSupportFragmentManager().beginTransaction().replace(R.id.container, new VideoFragment()).commit();
            }
        });

    }
}